package ua.vn.ticket_scanner.user;

import ua.vn.ticket_scanner.utils.Utils;

/**
 * Created by Ivan on 19.06.13.
 */
public class UserData {

    private static UserData instance = null;

    private String id;
    private String token;
    private String firstName;
    private String secondName;

    public static UserData getInstance() {
        if(instance == null) {
            instance = new UserData();
        }
        return instance;
    }

    private UserData() {
        token = Utils.md5(id);
    }

    public void clear() {
        id = null;
        token = null;
        firstName = null;
        secondName = null;
    }

    public boolean isLogined() {
        return id != null && token != null;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getSecondName() {
        return secondName;
    }

    public void setSecondName(String secondName) {
        this.secondName = secondName;
    }
}
